<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Group.js实例</title>
		<script src="./Group.js"></script>
	</head>
	<body>
		<div>
			<input type="text" class="time" value="" placeholder="输入时间戳" />
			<input type="button" value="开始倒计时" onclick="startTime()"/>
			<p id="items"></p>
		</div>
		<script>
            let ArrayGroup = new Groups.ArrayUtils();
            let DateGroup = new Groups.DateUtils();
            let PathGroup = new Groups.PathQuery();
            /* 倒计时 */
			let times='',leftTime,timer;
			function startTime(){
				leftTime = document.querySelector('.time').value;
				clearInterval(timer);
				timer = setInterval(() => {
					let dayStr='';
					times = DateGroup.TransTime(leftTime)
					leftTime = leftTime - 1;
					for(let key in times){
						switch(key){
							case 'm':
							keyName = '分';
							break;
							case 's':
							keyName = '秒';
							break;
							case 'h':
							keyName = '小时';
							break;
							case 'd':
							keyName = '天';
							break;
						}
						dayStr += ` ${times[key]}${keyName}`
					}
					document.getElementById('items').innerText  = '距离结束日期还有：'+dayStr;
				}, 1000)
			}
            /* get参数转json */
            let str = 'https://baidu.com?id=1&&a=1&&b=2&&c=张三'
            console.log(PathGroup.ParamJson(str))
            /* 数组去重 */
            console.log(ArrayGroup.SortArray([1,23,41,5,4,1,2,3,5,2,4,213]))
		</script>
</html>
